<%@page pageEncoding="UTF-8"%>
<%@ taglib uri="http://www.ptc.com/windchill/taglib/mvc" prefix="mvc"%>
<%@ taglib uri="http://www.ptc.com/windchill/taglib/wrappers" prefix="wrap"%>
<%@ page import="com.midea.part.resource.ComfirmationFormMessResource"%>
<%@ page import="java.util.ResourceBundle,java.util.Locale"%>
<%@ page import="com.midea.classification.ClassificationConstant"%>
<jsp:useBean id="Bean" class="com.ptc.netmarkets.util.beans.NmLocaleBean" scope="request"/>

<% 
	Locale locale = Bean.getLocale();
	ResourceBundle rb = ResourceBundle.getBundle("com.midea.part.resource.ComfirmationFormMessResource", locale);
	String search = rb.getString(ComfirmationFormMessResource.SEARCH);
%>

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css"
	href="/Windchill/netmarkets/javascript/ext/resources/css/ext-all.css" />

<script type="text/javascript"
	src="/Windchill/netmarkets/javascript/ext/adapter/ext/ext-base.js"></script>

<script type="text/javascript"
	src="/Windchill/netmarkets/javascript/ext/ext-all.js"></script>

<script type="text/javascript"
	src="/Windchill/netmarkets/javascript/ext/ux/CheckColumn.js"></script>

<script type="text/javascript">
var inputrecords = new Array();
var modelrecords = new Array();
var outputrecords = new Array();

function chooseRDClf(records,index){
	var Clf = "rdClf";
	var record = records[index];
	window.showModalDialog(getBaseHref()+"ptc1/midea/module/addRDClf?class=" + Clf, record, "dialogHeight:600px;dialogWidth:700px;resizable:yes;status:no;scroll:yes;toolbar:no;menubar:no;location:no");
}

function chooseClf(records,index){
	setRadio(records,index);
	var Clf = "rdClf";
	var record = records[index];
	if(record.data.modelRange == "机型"){
		Clf = "platformClf";
	}
	window.showModalDialog(getBaseHref()+"ptc1/midea/module/addRDClf?class=" + Clf, record, "dialogHeight:600px;dialogWidth:700px;resizable:yes;status:no;scroll:yes;toolbar:no;menubar:no;location:no");
}

function searchPartNo(records,index){
	var record = records[index];
	window.showModalDialog(getBaseHref()+"ptc1/midea/module/searchPartNo", record, "dialogHeight:600px;dialogWidth:700px;resizable:yes;status:no;scroll:yes;toolbar:no;menubar:no;location:no");
}

function attributeCondition(records,index){
	var record = records[index];
	if(record.data.modelRange){
		setRadio(records,index);
	}
	var Clfname = "";
	var data = record.data.Clf_oid;
	if(data && data!==""){
		Clfname = getData(data).split("|")[0];
		Clfname= encodeURI(Clfname);
		var values = encodeURI(record.data.attributeCondition_hidden);
		window.showModalDialog(getBaseHref()+"ptc1/midea/module/attributeCondition?class=" + Clfname + "&values=" + values, record, "dialogHeight:600px;dialogWidth:700px;resizable:yes;status:no;scroll:yes;toolbar:no;menubar:no;location:no");
	}
}

function interfaceCondition(records,index){
	var record = records[index];
	if(record.data.modelRange){
		setRadio(records,index);
	}
	var data = record.data.Clf_oid;
	if(data && data!==""){
		var values = encodeURI(record.data.interfaceCondition_hidden);
		window.showModalDialog(getBaseHref()+"ptc1/midea/module/interfaceCondition?oid=" + data + "&values=" + values, record, "dialogHeight:600px;dialogWidth:700px;resizable:yes;status:no;scroll:yes;toolbar:no;menubar:no;location:no");
	}
}

function setRadio(records, index){
	var record = records[index];
	record.set("radio", true);
	if(index == 0){
		records[1].set("radio", false);
	}else{
		records[0].set("radio", false);
	}
	record.store.commitChanges();
}

function getData(oid) {
	var choice = "";
	var ajaxOptions = {
		asynchronous : false,
		method : "GET",
		onSuccess : function(result, options) {
			var jsonData = Ext.util.JSON.decode(result.responseText.trim());
			var resultMessage = jsonData.message;
			var result = jsonData.result;
			choice = result;
		},
		parameters : {
			oid : oid
		}
	};
	requestHandler.doRequest(
			"netmarkets/jsp/midea/module/getChooseData.jsp", ajaxOptions);
	return choice
}

function submitParameters(){
	var inputData = getInputData(inputrecords);
	var modelRangeData = getModelRangeData(modelrecords);
	var outputData = getOutputData(outputrecords);
	var params = {
		inputData : inputData,
		modelRangeData : modelRangeData,
		outputData : outputData
	};
	PTC.jca.table.Utils.reload('com.midea.module.mvc.builders.SearchForResultBuilder', params, true);
}

Ext.data.Store.prototype.nextPreviousResultSetOnClickHandler = function (store, id, params) {
	var grid = PTC.jca.table.Utils.getTable(store.jscaTableID);
	var jcaTableConfig = grid.jcaTableConfig;
	if (!PTC.jca.nextPreviousActions.validate(store.jscaTableID)) {
		return;
	}
	var pagingBar = grid.getBottomToolbar();
	var warningMsg = grid.getBottomToolbar().findById(store.jscaTableID + '_tablelvlmesg');
	if (warningMsg !== null) {
		warningMsg.hide();
	}
	var errorMsg = grid.getBottomToolbar().findById(store.jscaTableID + '_tablelvlmesg_Err');
	if (errorMsg !== null) {
		errorMsg.hide();
	}
	var fire = true;
	var offset = 0;
	var nxtLinkId = PTC.jca.nextPreviousActions.getNextLinkId(jcaTableConfig.tableID);
	if (id === nxtLinkId) {
		if (jcaTableConfig.pageOffset === undefined) {
			var titleBar = grid.getTopToolbar();
			titleBar.getComponent(grid.cancelBtnId).hide();
			offset = jcaTableConfig.pageSize;
	  	} else {
	   		if (store.moreData) {
	        	offset = jcaTableConfig.pageOffset + jcaTableConfig.pageLimit;
	       	} else {
	          	fire = false;
	     	}
	   	}
	 	pagingBar.items.items[1].show();
	} else {
	  	if (jcaTableConfig.pageOffset === undefined || jcaTableConfig.pageOffset === 0) {
	     	fire = false;
	  	} else {
	      	offset = jcaTableConfig.pageOffset - jcaTableConfig.pageLimit;
		}
	}
	if (fire) {
	 	store.baseParams.offset = offset;
	  	store.baseParams.tableId = jcaTableConfig.tableID;
	 	if (store.pagingSessionId !== undefined) {
	       	store.baseParams.PAGING_SESSION_ID = store.pagingSessionId;
	   	}
	 	store.moreData = false;
	  	store.load_complete = false;
	   	params = params || {};
	   	params = Ext.applyIf(params, grid.initRequestParams);
	   	if(jcaTableConfig.tableID == "com.midea.module.mvc.builders.SearchForResultBuilder"){
	      	var inputData = getInputData(inputrecords);
	       	var modelRangeData = getModelRangeData(modelrecords);
	      	var outputData = getOutputData(outputrecords);
	     	params = {
	        	inputData : inputData,
	        	modelRangeData : modelRangeData,
	        	outputData : outputData
	       	};
	  	}
	   	PTC.jca.table.Utils.reload(jcaTableConfig.tableID, params, true);
	}
};

function getInputData(records){
	var data = "";
	for(var i = 0; i < records.length; i++){
		var record = records[i];
		var values = new Array();
		data += record.data.inputchoose + "__";
		data += record.data.reject + "__";
		data += record.data.Clf_oid + "__";
		data += record.data.part_oid + "__";
		data += record.data.attributeCondition_hidden + "__";
		data += record.data.interfaceCondition_hidden + "__";
		data += i + "##";
	}
	data = data.substr(0,data.length-2);
	return data;
}

function getModelRangeData(records){
	var data = "";
	for(var i = 0; i < records.length; i++){
		var record = records[i];
		if(record.data.radio){
			data += record.data.modelRange + "__";
			data += record.data.Clf_oid + "__";
			data += record.data.attributeCondition_hidden + "__";
			data += record.data.interfaceCondition_hidden + "__" + 0;
		}
	}
	return data;
}

function getOutputData(records){
	var data = "";
	for(var i = 0; i < records.length; i++){
		var record = records[i];
		var values = new Array();
		data += record.data.outputchoose + "__";
		data += record.data.Clf_oid + "__";
		data += record.data.part_oid + "__";
		data += record.data.attributeCondition_hidden + "__";
		data += record.data.interfaceCondition_hidden + "__";
		data += i + "##";
	}
	data = data.substr(0,data.length-2);
	return data;
}

Ext.grid.CheckColumn = function(config){
    Ext.apply(this, config);  
    if(!this.id){  
        this.id = Ext.id();  
    }  
    this.renderer = this.renderer.createDelegate(this);  
};  
  
Ext.grid.CheckColumn.prototype ={  
    init : function(grid){  
        this.grid = grid;  
        this.grid.on('render', function(){  
            var view = this.grid.getView();  
            view.mainBody.on('mousedown', this.onMouseDown, this);  
        }, this);  
    },  
  
    onMouseDown:function(e, t) {
		if (t.className && t.className.indexOf('x-grid3-cc-' + this.id) != -1) {
			e.stopEvent();
			var index = this.grid.getView().findRowIndex(t);
			var cindex = this.grid.getView().findCellIndex(t);
			var record = this.grid.store.getAt(index);
			var field = this.grid.colModel.getDataIndex(cindex);
			var check = false;
			if('true'== record.data[this.dataIndex] || true == record.data[this.dataIndex]){
				check = true;
			}
			var e = {
				grid : this.grid,
				record : record,
				field : field,
				originalValue : check,
				value : !check,
				row : index,
				column : cindex,
				cancel : false
			};
			if (this.grid.fireEvent("validateedit", e) !== false && !e.cancel) {
				delete e.cancel;
				record.set(this.dataIndex, !check);
				if(this.dataIndex == "inputchoose"){
					record.set("reject", check);
				}else{
					record.set("inputchoose", check);
				}
				record.commit();
				this.grid.fireEvent("afteredit", e);
				this.renderer(check);
			}
		}
	},
  
    renderer : function(v, p, record){
    	var check = false;
    	if('true'== v || true == v){
    		check = true;
    	}
        p.css += ' x-grid3-check-col-td'; 
        var ret = String.format('<div class="x-grid3-check-col{0} {1}">&#160;</div>', check ? '-on' : '', this.createId());
        return ret;
    },
    
    createId : function(){
        return 'x-grid3-cc-' + this.id;
    }       
};

Ext.grid.RadioColumn = function(config){  
    Ext.apply(this, config);  
    if(!this.id){  
        this.id = Ext.id();  
    }  
    this.renderer = this.renderer.createDelegate(this);  
};  
  
Ext.grid.RadioColumn.prototype ={  
    init : function(grid){  
        this.grid = grid;  
        this.grid.on('render', function(){  
            var view = this.grid.getView();  
            view.mainBody.on('mousedown', this.onMouseDown, this);  
        }, this);  
    },  
  
    onMouseDown:function(e, t) {
		if (t.className && t.className.indexOf('x-grid3-cc-' + this.id) != -1) {
			e.stopEvent();
			var index = this.grid.getView().findRowIndex(t);
			var cindex = this.grid.getView().findCellIndex(t);
			var record = this.grid.store.getAt(index);
			var field = this.grid.colModel.getDataIndex(cindex);
			var check = false;
			if('true'== record.data[this.dataIndex] || true == record.data[this.dataIndex]){
				check = true;
			}
			var e = {
				grid : this.grid,
				record : record,
				field : field,
				originalValue : check,
				value : !check,
				row : index,
				column : cindex,
				cancel : false
			};
			if (this.grid.fireEvent("validateedit", e) !== false && !e.cancel) {
				delete e.cancel;
				record.set(this.dataIndex, !check);
				this.grid.fireEvent("afteredit", e);
				this.renderer(check);
			}
		}
	},
  
    renderer : function(v, p, record){
    	var check = false;
    	if('true'== v || true == v){
    		check = true;
    	}
        p.css += ' x-grid3-check-col-td'; 
        var ret = String.format('<div class="x-grid3-check-col{0} {1}">&#160;</div>', check ? '-on' : '', this.createId());
        return ret;
    },
    
    createId : function(){
        return 'x-grid3-cc-' + this.id;
    }       
};

</script>
</head>

<body>
	<div id="editor-grid1"></div>
	<div id="editor-grid2"></div>
	<div id="editor-grid3"></div>
</body>

<%
	String rdClfInnerName = ClassificationConstant.RESEARCH_CLASSIFICATION;
%>

<script type="text/javascript">
/*
 * ! Ext JS Library 3.2.0 Copyright(c) 2006-2010 Ext JS, Inc.
 * licensing@extjs.com http://www.extjs.com/license
 */
Ext.onReady(function(){
	Ext.QuickTips.init();
	
    // shorthand alias
	var title_edit = new Ext.form.TextField({
		allowBlank:true
	});
    
    var inputChooseValued = new Ext.grid.CheckColumn({  
        id:'inputchoose',
        header: "选择",  
        dataIndex: 'inputchoose',  
        width: 40,
        grid:''
     });
    
    var outputChooseValued = new Ext.grid.CheckColumn({  
        id:'outputchoose',
        header: "选择",  
        dataIndex: 'outputchoose',  
        width: 40,
        grid:''
     });
    
    var rejectValued = new Ext.grid.CheckColumn({  
        id:'reject',
        header: "排除",  
        dataIndex: 'reject',  
        width: 40,
        grid:''
     });
    
    var modelRangeValued = new Ext.grid.RadioColumn({  
        id:'modelRange',
        header: "机型范围",  
        dataIndex: 'modelRange',  
        width: 120,
        grid:''
     });
    
    var inputcm = new Ext.grid.ColumnModel({
        columns: [
		new Ext.grid.CheckboxSelectionModel ({singleSelect : false}),
        new Ext.grid.RowNumberer(),
        inputChooseValued,
        rejectValued,
        {
        	id: 'RDClf',
            header: '研发分类',
            dataIndex: 'RDClf',
            width: 160,
            renderer:function(value, data, record, rowIndex, colIndex, store){
            	renderer = "<input type='text' readonly='readonly' value='" + record.data.RDClf + "'/>";
            	inputrecords[rowIndex] = record;
            	renderer += "<img id='picker' onclick='chooseRDClf(inputrecords," + rowIndex + ")' src='netmarkets/images/search_14x14.png' complete='complete'/>";
            	return renderer;
            }
        },{
        	id: 'number',
            header: '构件编码',
            dataIndex: 'number',
            width: 160,
            renderer:function(value, data, record, rowIndex, colIndex, store){
            	renderer = "<input type='text' readonly='readonly' value='" + record.data.number + "'/>";
            	renderer += "<img id='picker' onclick='searchPartNo(inputrecords," + rowIndex + ")' src='netmarkets/images/search_14x14.png' complete='complete'/>";
            	return renderer;
            }
        },{
        	id: 'name',
            header: '构件名称',
            dataIndex: 'name',
            width: 160
        },{
        	id: 'code',
            header: '代号',
            dataIndex: 'code',
            width: 160
        },{
        	id: 'attributeCondition',
            header: '属性条件',
            dataIndex: 'attributeCondition',
            width: 160,
            renderer:function(value, data, record, rowIndex, colIndex, store){
            	renderer = "<input type='text' readonly='readonly' value='" + record.data.attributeCondition + "'/>";
            	renderer += "<img id='picker' onclick='attributeCondition(inputrecords," + rowIndex + ")' src='netmarkets/images/search_14x14.png' complete='complete'/>";
            	return renderer;
            }
        },{
        	id: 'interfaceCondition',
            header: '接口条件',
            dataIndex: 'interfaceCondition',
            width: 160,
            renderer:function(value, data, record, rowIndex, colIndex, store){
            	renderer = "<input type='text' readonly='readonly' value='" + record.data.interfaceCondition + "'/>";
            	renderer += "<img id='picker' onclick='interfaceCondition(inputrecords," + rowIndex + ")' src='netmarkets/images/search_14x14.png' complete='complete'/>";
            	return renderer;
            }
        }]
    });
    
    var inputdata = [ 
			[true, false, '', '', '', '', '', '', '', '', ''] 
		]; 
    
    var inputstore = new Ext.data.Store({
    	proxy: new Ext.data.MemoryProxy(inputdata), 
    	reader: new Ext.data.ArrayReader({}, [ 
    	{ name: 'inputchoose', type:'bool' }, { name: 'reject', type:'bool' }, { name: 'RDClf' }, { name: 'Clf_oid' }, { name: 'number' }, { name: 'part_oid' }, { name: 'name' }, { name: 'code' }, { name: 'attributeCondition' }, { name: 'attributeCondition_hidden' }, { name: 'interfaceCondition' }, { name: 'interfaceCondition_hidden' }
    	])
    });
    inputstore.load();
    
    var inputgrid = new Ext.grid.EditorGridPanel({
    	id :'inputPanel',
    	store : inputstore,
    	sm : new Ext.grid.CheckboxSelectionModel(),
    	cm : inputcm,
        renderTo : 'editor-grid1',
        autoWidth : true,
        autoHeight : true,
    	frame : true,
    	plugins:[inputChooseValued,rejectValued], 
        stripeRows : true,
        columnLines : true,
        clicksToEdit : 1,
        autoScroll : true,
    	title : "输入条件",
    	tbar: [{
			id:'inputaddRow',
            icon: '/Windchill/netmarkets/images/add16x16.gif',
			listeners:{'click':function(a,b,c){
				var store1 = inputgrid.getStore();
				var Plant = store1.recordType;
                var p = new Plant({
                	inputchoose:true,
                	reject:false,
                	RDClf:'',
                	Clf_oid:'',
                	number:'',
                	part_oid:'',
                	name:'',
                	code:'',
                	attributeCondition:'',
                	attributeCondition_hidden:'',
                	interfaceCondition:'',
                	interfaceCondition_hidden:''
                });
                inputgrid.stopEditing();
                inputstore.insert(store1.getCount(), p);
                inputgrid.startEditing(0, 0);
			}}
            },{
            id:'inputremoveRow',
            icon: '/Windchill/netmarkets/images/remove16x16.gif',
            listeners:{'click':function(a,b,c){
				var selections = inputgrid.selModel.getSelections();
				if(selections.length > 0){//有选中行
					Ext.each(selections, function(item) {
						inputgrid.getStore().remove(item);
					});
					inputgrid.view.refresh();
				}else {//无选中行
					Ext.Msg.show({
						title : '错误提示',
						msg : '未作任何选择。',
						buttons : Ext.Msg.OK,
						icon : Ext.Msg.ERROR
					});
				}
            }}
			}]
  	});
    
    var modelRangecm = new Ext.grid.ColumnModel({
        columns: [
        new Ext.grid.RowNumberer(),
        {
        	id: 'radio',
            header: '',
            dataIndex: 'radio',
            width: 30,
            renderer:function(value, data, record, rowIndex, colIndex, store){
            	if(record.data.radio){
            		renderer = "<input name='radio' type='radio' checked='checked'/>";
            	}else{
            		renderer = "<input name='radio' type='radio'/>";
            	}
            	return renderer;
            }
        },{
        	id: 'modelRange',
            header: '机型范围',
            dataIndex: 'modelRange',
            width: 100,
        },{
        	id: 'platformOrRDClf',
            header: '平台/研发分类',
            dataIndex: 'platformOrRDClf',
            width: 160,
            renderer:function(value, data, record, rowIndex, colIndex, store){
            	renderer = "<input type='text' readonly='readonly' value='" + record.data.platformOrRDClf + "'/>";
            	modelrecords[rowIndex] = record;
            	renderer += "<img id='picker' onclick='chooseClf(modelrecords," + rowIndex + ")' src='netmarkets/images/search_14x14.png' complete='complete'/>";
            	return renderer;
            }
        },{
        	id: 'attributeCondition',
            header: '属性条件',
            dataIndex: 'attributeCondition',
            width: 160,
            renderer:function(value, data, record, rowIndex, colIndex, store){
            	renderer = "<input type='text' readonly='readonly' value='" + record.data.attributeCondition + "'/>";
            	renderer += "<img id='picker' onclick='attributeCondition(modelrecords," + rowIndex + ")' src='netmarkets/images/search_14x14.png' complete='complete'/>";
            	return renderer;
            }
        },{
        	id: 'interfaceCondition',
            header: '接口条件',
            dataIndex: 'interfaceCondition',
            width: 160,
            renderer:function(value, data, record, rowIndex, colIndex, store){
            	renderer = "<input type='text' readonly='readonly' value='" + record.data.interfaceCondition + "'/>";
            	renderer += "<img id='picker' onclick='interfaceCondition(modelrecords," + rowIndex + ")' src='netmarkets/images/search_14x14.png' complete='complete'/>";
            	return renderer;
            }
        }]
    });
    
    var modelRangedata = [ 
			[true, '机型', '', '', ''], 
			[false, '物料', '', '', '']
		]; 
    
    var modelRangestore = new Ext.data.Store({
    	proxy: new Ext.data.MemoryProxy(modelRangedata), 
    	reader: new Ext.data.ArrayReader({}, [ 
    	{ name: 'radio', type:'bool' }, { name: 'modelRange' }, { name: 'platformOrRDClf' }, { name: 'Clf_oid' }, { name: 'attributeCondition' }, { name: 'attributeCondition_hidden' }, { name: 'interfaceCondition' }, { name: 'interfaceCondition_hidden' }
    	]) 
    });
    modelRangestore.load();
    
    var modelRangegrid = new Ext.grid.EditorGridPanel({
    	id :'modelRangePanel',
    	store : modelRangestore,
    	sm : new Ext.grid.CheckboxSelectionModel(),
    	cm : modelRangecm,
        renderTo : 'editor-grid2',
        autoWidth : true,
        autoHeight : true,
    	frame : true,
    	plugins:[modelRangeValued],
        stripeRows : true,
        columnLines : true,
        autoScroll : true,
    	title : '机型范围',
    	listeners:{
    		rowclick : function(grid, rowIndex){
    			var record = grid.getStore().getAt(rowIndex);
    			record.set("radio", true);
    			if(rowIndex == 0){
    				grid.getStore().getAt(1).set("radio", false);
    			}else{
    				grid.getStore().getAt(0).set("radio", false);
    			}
    			grid.getStore().commitChanges();
    		}
    	}
  	});
    
    var outputcm = new Ext.grid.ColumnModel({
        columns: [
		new Ext.grid.CheckboxSelectionModel ({singleSelect : false}),
        new Ext.grid.RowNumberer(),
        outputChooseValued,
        {
        	id: 'RDClf',
            header: '研发分类',
            dataIndex: 'RDClf',
            width: 160,
            renderer:function(value, data, record, rowIndex, colIndex, store){
            	renderer = "<input type='text' readonly='readonly' value='" + record.data.RDClf + "'/>";
            	outputrecords[rowIndex] = record;
            	renderer += "<img id='picker' onclick='chooseRDClf(outputrecords," + rowIndex + ")' src='netmarkets/images/search_14x14.png' complete='complete'/>";
            	return renderer;
            }
        },{
        	id: 'number',
            header: '构件编码',
            dataIndex: 'number',
            width: 160,
            renderer:function(value, data, record, rowIndex, colIndex, store){
            	renderer = "<input type='text' readonly='readonly' value='" + record.data.number + "'/>";
            	renderer += "<img id='picker' onclick='searchPartNo(outputrecords," + rowIndex + ")' src='netmarkets/images/search_14x14.png' complete='complete'/>";
            	return renderer;
            }
        },{
        	id: 'name',
            header: '构件名称',
            dataIndex: 'name',
            width: 160
        },{
        	id: 'code',
            header: '代号',
            dataIndex: 'code',
            width: 160
        },{
        	id: 'attributeCondition',
            header: '属性条件',
            dataIndex: 'attributeCondition',
            width: 160,
            renderer:function(value, data, record, rowIndex, colIndex, store){
            	renderer = "<input type='text' readonly='readonly' value='" + record.data.attributeCondition + "'/>";
            	renderer += "<img id='picker' onclick='attributeCondition(outputrecords," + rowIndex + ")' src='netmarkets/images/search_14x14.png' complete='complete'/>";
            	return renderer;
            }
        },{
        	id: 'interfaceCondition',
            header: '接口条件',
            dataIndex: 'interfaceCondition',
            width: 160,
            renderer:function(value, data, record, rowIndex, colIndex, store){
            	renderer = "<input type='text' readonly='readonly' value='" + record.data.interfaceCondition + "'/>";
            	renderer += "<img id='picker' onclick='interfaceCondition(outputrecords," + rowIndex + ")' src='netmarkets/images/search_14x14.png' complete='complete'/>";
            	return renderer;
            }
        }]
    });
    
    var outputdata = [ 
			[true, '', '', '', '', '', ''] 
		]; 
    
    var outputstore = new Ext.data.Store({
    	proxy: new Ext.data.MemoryProxy(outputdata), 
    	reader: new Ext.data.ArrayReader({}, [ 
    	{ name: 'outputchoose', type:'bool' }, { name: 'RDClf' }, { name: 'Clf_oid' }, { name: 'number' }, { name: 'part_oid' }, { name: 'name' }, { name: 'code' }, { name: 'attributeCondition' }, { name: 'attributeCondition_hidden' }, { name: 'interfaceCondition' }, { name: 'interfaceCondition_hidden' }
    	]) 
    });
    outputstore.load();
    
    var outputgrid = new Ext.grid.EditorGridPanel({
    	id :'outputPanel',
    	store : outputstore,
    	sm : new Ext.grid.CheckboxSelectionModel(),
    	cm : outputcm,
        renderTo : 'editor-grid3',
        autoWidth : true,
        autoHeight : true,
    	frame : true,
    	plugins:[outputChooseValued], 
        stripeRows : true,
        columnLines : true,
        autoScroll : true,
    	title : "输出条件",
    	tbar: [{
			id:'outputaddRow',
            icon: '/Windchill/netmarkets/images/add16x16.gif',
			listeners:{'click':function(a,b,c){
				var store1 = outputgrid.getStore();
				var Plant = store1.recordType;
                var p = new Plant({
                	outputchoose:true,
                	RDClf:'',
                	Clf_oid:'',
                	number:'',
                	part_oid:'',
                	name:'',
                	code:'',
                	attributeCondition:'',
                	attributeCondition_hidden:'',
                	interfaceCondition:'',
                	interfaceCondition_hidden:''
                });
                outputgrid.stopEditing();
                outputstore.insert(store1.getCount(), p);
                outputgrid.startEditing(0, 0);
			}}
            },{
            id:'outputremoveRow',
            icon: '/Windchill/netmarkets/images/remove16x16.gif',
            listeners:{'click':function(a,b,c){
				var selections = outputgrid.selModel.getSelections();
				if(selections.length > 0){//有选中行
					Ext.each(selections, function(item) {
						outputgrid.getStore().remove(item);
					});
					outputgrid.view.refresh();
				}else {//无选中行
					Ext.Msg.show({
						title : '错误提示',
						msg : '未作任何选择。',
						buttons : Ext.Msg.OK,
						icon : Ext.Msg.ERROR
					});
				}
            }}
		}]
  	});
});

</script>

<table width="100%">
	<tr>
		<td align="right">
			<wrap:button name="search" value="<%=search%>" onclick="submitParameters();" />
		</td>
	</tr>
</table>

<jsp:include page="${mvc:getComponentURL('com.midea.module.mvc.builders.SearchForResultBuilder')}" />

</html>
